<?php
/**
 * 标签页
 *
 */
class CategoryAction extends BaseAction {
    public function index(){
		$database_Category = D('Category');
		
		//$category_list = $database_Category->order('`cid` ASC,`pid` ASC')->select();
		//$category_list=$database_Category->query('SELECT * FROM ic_Category');
		$category_list=$database_Category->select();
		$this->assign('category_list',$category_list);
		//$category_list="sss";
		//dump($category_list);
		$this->display();
	}
	public function add(){
		$this->display();
	}
	public function modify(){
		$database_category = D('Category');
			
		if($database_category->data($_POST)->add()){
			$this->success('增加成功！');
		}else{
			$this->error('增加失败！');
		}
	}
	public function edit(){
		$database_hot_tag = D('Category');
		$condition_hot_tag['cid'] = $this->_get('cid');
		$category = $database_hot_tag->where($condition_hot_tag)->find();
		$this->assign('category',$category);
		
		$this->display();
	}
	public function amend(){
		$database_hot_tag = D('Category');
			
		if($database_hot_tag->data($_POST)->save()){
			$this->success('修改成功！');
		}else{
			$this->error('修改失败！');
		}
	}
	public function del(){
		$database_category = D('Category');
		$condition_category['cid'] = $this->_get('cid');
		dump( $condition_category['cid']);
		if(!empty($condition_category['cid']) && $database_category->where($condition_category)->delete()){
			$this->success('删除成功！');
		}else{
			$this->error('删除失败！');
		}
	}
}